package org.apache.dubbo.spi;

import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.extension.ExtensionLoader;
import org.apache.dubbo.spi.domain.Admin;
import org.apache.dubbo.spi.domain.Human;
import org.apache.dubbo.spi.domain.Robot;

/**
 * @author duyutian
 * @version 1.0
 * @date 2020/7/28 11:03
 */
public class DubboSpi {

    public static void main(String[] args) {
        ExtensionLoader<Robot> extensionLoader =
                ExtensionLoader.getExtensionLoader(Robot.class);
        Robot optimusPrime = extensionLoader.getExtension("optimusPrime");
        optimusPrime.sayHello();
        Robot bumblebee = extensionLoader.getExtension("bumblebee");
        bumblebee.sayHello();
        ExtensionLoader<Human> extensionLoader1 = ExtensionLoader.getExtensionLoader(Human.class);
        URL url = new URL("", "", 0);
        URL url1 = url.addParameter("key", "wuman");
        extensionLoader1.getAdaptiveExtension().say(url1);
        ExtensionLoader<Admin> extensionLoader2 = ExtensionLoader.getExtensionLoader(Admin.class);
        Admin dog = extensionLoader2.getExtension("dog");
        dog.run();

    }


}
